import React, { Component } from 'react'
import { Switch, Route } from 'react-router-dom/'

const Index = React.lazy(()=>import('../views/Index'))
const Redux = React.lazy(()=>import('../views/Redux'))
const PageA = React.lazy(()=>import('../views/PageA'))
const CountClass = React.lazy(()=>import('../views/CountClass'))
const CountFn = React.lazy(()=>import('../views/CountFn'))
const CountFn1 = React.lazy(()=>import('../views/CountFn1'))
const Antd = React.lazy(()=>import('../views/Antd'))
const Http = React.lazy(()=>import('../views/Http'))

export default class Router extends Component {
  render() {
    return (
      <React.Suspense fallback={<div>loading...</div>}>
          <Switch>
              <Route path="/index" component={Index}></Route>
              <Route path="/redux" component={Redux}></Route>
              <Route path="/pagea" component={PageA}></Route>
              <Route path="/countclass" component={CountClass}></Route>
              <Route path="/countfn" component={CountFn}></Route>
              <Route path="/countfn1" component={CountFn1}></Route>
              <Route path="/antd" component={Antd}></Route>
              <Route path="/http" component={Http}></Route>
          </Switch>
      </React.Suspense>
    )
  }
}
